

abstract class Shape {

    public String name;
    public abstract void draw();
}

abstract class A extends Shape {

}

class C extends A {
    @Override
    public void draw() {

    }
}

class Flower extends Shape {
    @Override
    public void draw() {
        System.out.println("❀！");
    }
}

class Rect extends Shape {
    public void draw() {
        System.out.println("□！");
    }
}

class Triangle extends Shape {
    public void draw() {
        System.out.println("△！");
    }
}

class Cycle extends Shape {
    public void draw() {
        System.out.println("○！");
    }
}

public class Test2 {
    public static void drawMap(Shape shape) {
        shape.draw();
    }
    public static void main(String[] args) {
        Shape shape = new Cycle();
        //因为抽象类不能实例化，所以只能向上转型
        drawMap(shape);
    }
    public static void main1(String[] args) {
        Shape[] shapes = {new Cycle(), new Rect(), new Cycle(), new Rect(), new Triangle()};
        for (Shape shape : shapes) {
            shape.draw();
        }
    }

}
